<div class="brand">点餐</div>
<ul class="top_menu">
  <li class="">
    <a href="Order.html">
      <i class="iconfont icon-diancan"></i>
      <span>点餐</span>
    </a>
  </li>
  <li class="line"></li>
  <li>
    <a href="Table.html">
      <i class="iconfont icon-zhuotai"></i>
      <span>桌台</span>
    </a>
  </li>
  <li class="line"></li>
  <li>
    <a href="orderForm.html">
      <i class="iconfont icon-dingdanguanli"></i>
      <span>订单管理</span>
    </a>
  </li>
  <li class="line"></li>
  <li>
    <a class="loginOut">
      <i class="iconfont icon-dingdanguanli"></i>
      <span>退出登录</span>
    </a>
  </li>
  <!-- <li class="line"></li>
  <li>
    <a href="">
      <i class="iconfont icon-xitong"></i>
      <span>系统设置</span>
    </a>
  </li>
  <li class="line"></li>
  <li>
    <a href="">
      <i class="iconfont icon-chudaxiaoxi"></i>
      <span>厨打消息</span>
    </a>
  </li>
  <li class="line"></li>
  <li>
    <a href="">
      <i class="iconfont icon-gengduo"></i>
      <span>更多</span>
    </a>
  </li> -->
</ul>

<script>
  $(function () {
    // alert(navigator.onLine);
    //     applicationCache.update();
    //     window.applicationCache.onupdateready = function(){
    //         location.reload();
    // }
    $(".loginOut").off("click").on("click", function () {
      var tableInfos = JSON.parse(localStorage.getItem("tableInfos") || "[]");
      var hasOrderArr = tableInfos.filter(function (m) {
        return m.hasOrder == 1 && m.cart && m.cart.length > 0
      })
      if (hasOrderArr.length > 0) {
        layer.open({
          content: "有未上传订单",
          btn: ["上传并退出", "直接退出"],
          yes: function (index) {
            hasOrderArr.forEach(function (v) {
              App.loginOutOrder(v);
            })
            layer.close(index);
            location.href = "../login.html"
            localStorage.removeItem("curTable");
            localStorage.removeItem("tableInfos");
            localStorage.removeItem("payCode");
          },
          no: function () {
            location.href = "../login.html"
            localStorage.removeItem("curTable");
            localStorage.removeItem("tableInfos");
            localStorage.removeItem("payCode");
          }
        })
      } else {
        App.confirm("确定退出登录？", function () {
          location.href = "../login.html"
          localStorage.removeItem("curTable");
          localStorage.removeItem("tableInfos");
          localStorage.removeItem("allTables");
          localStorage.removeItem("payCode");
        })
      }
    })
  })
</script>